from Tkinter import *

class Plot( Frame ):
    # drawing a "nuage" of points
    def __init__(self, parent, coords, colour):
            Frame.__init__(self, parent)
            self.parent=parent
            self.canvas = Canvas(parent, height = 400, width = 400)
            self.nb_pts = len(coords)
            curr_max_x = 0
            curr_max_y = 0
            for curr_pt in coords:
                if curr_pt[0]>curr_max_x:
                    curr_max_x=curr_pt[0]
                if curr_pt[1]>curr_max_y:
                    curr_max_y=curr_pt[1]
            k_x = 400/curr_max_x
            k_y = 400/curr_max_y
            for pt in coords:
                x=pt[0]
                y=pt[1]
                self.canvas.create_rectangle(x-3, y-3, x+3, y+3, fill=colour)
            self.canvas.pack()
    
